var goodsName_flag = true;

function goodsName_validata() {

    var goodsName = $("#goodsName");

    if (!ge_two_letters_regex.test(goodsName.val())) {
        goodsName_flag = false;
        $("#goodsName_info").html("商品名称必须大于2个非空白字符！");
        return;
    }

    var project_path = $("#form1").attr("project_path");
    var submit_path=project_path+"/goods/isExistsByGoodsName";
    $.ajax({
        type: "get",
        url: submit_path ,
        data: {goodsName: goodsName.val()},
        success: function (isExists) {
            if (isExists) {
                goodsName_flag = false;
                $("#goodsName_info").html("商品名称已经存在！");
            } else {
                goodsName_flag = true;
                $("#goodsName_info").html("");
            }
        }
    });
}

$("#goodsName").blur(function () {
    goodsName_validata();
});

$("#btn_submit").click(function () {

    goodsName_validata();

    if (goodsName_flag){

        $("#details").val($("#editor").html());

        $("#form1").submit();
    }

});
var quill = new Quill('#editor', {
    theme: 'snow'
});
